package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Data;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * @author 猫教授
 * @date 2019/8/18 11:49
 */
@Data
public class DestQueryObject extends QueryObject {

    private  String orderBy = "id";  //排序

    private Integer type=1;
    private Integer time = -1;   //时间
    private Integer theme = -1; //主题
    private Integer day = -1;   //出行天数


    public Pageable getPageable(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize(), Sort.Direction.DESC, orderBy);
        return  of;
    }
    public Pageable getPageableWithoutSort(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize());
        return  of;
    }
}
